import {Component, OnInit, Input} from '@angular/core';
import {Banner} from '../../module/banner';

@Component({
  moduleId: module.id,
  selector: 'app-slider',
  templateUrl: 'slider.component.html',
  styleUrls: ['slider.component.css'],
})
export class SliderComponent implements OnInit {
  @Input() bannerList: Banner[];
  currentPic = 0;

  constructor() {

  }

  ngOnInit() {
    setInterval(() => {
      this.currentPic = (this.currentPic + 1) % this.bannerList.length;
    }, 3000);
  }

  changebanner(id) {
    this.currentPic = id;
  }
}
